import Utils from '../utils.js';
export default {
	init: function() {
		let _this = this;
		let obj = {
			nickNameObj: $(".nickName"),
			phoneNumObj: $(".phoneNum"),
			phoneCodeObj: $(".phoneCode"),
			liveTitleObj: $(".liveTitle"),
			selfcheckboxObj: $(".selfcheckbox")
		}
		// 保存
		$(".saveBtn").on("click", function(e) {
			let nickName = obj.nickNameObj.val();
			let phoneNum = obj.phoneNumObj.val();
			if(!Utils._spaceCheck(nickName)) {
				$.message({message: '输出名称不能为空!', type: 'info'});
				return;
			}
			if(!Utils._phoneCheck(phoneNum)) {
				$.message({message: '请输入格式正确的手机号码', type: 'info'});
				return;
			}
			_this.saveAuthInfo(obj);
		});
		// 取消
		$(".quitBtn,.closeBtn").on("click", function(e) {
			Utils._closeParent("yizhiboAdd");
		});
		// 获取短信验证码
		$(".ssmCode").on("click", function() {
			let phoneNum = obj.phoneNumObj.val();
			if(!Utils._spaceCheck(phoneNum) || !Utils._phoneCheck(phoneNum)) {
				$.message({message: '请输入格式正确的手机号码', type: 'info'});
				return;
			}
			_this.getSsmCode();
		});
		$(".selfcheckbox").on("click", function() {
			$(this).toggleClass("is-checked");
		});
	},
	saveAuthInfo: function(obj) {
		console.log(obj);
		// let obj = {
		// 	nickName: nickName,
		// 	isAuto: isAuto,
		// 	type: "Y",
		// 	token: token,
		// 	rtmpId: serverUrl,
		// 	shareType: isAuto == '0' ? 1: 0
		// }
	}
}